<html lang="zh-Hans">
<head>
	<meta charset="utf-8">
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" href="${rc.contextPath}/resources/amazeui/css/amazeui.min.css">
	<style type="text/css">
	.am-radio-inline{font-size: 18px;}
	#id-main{width: 100vw;height:100vh; background-image: url('http://ocsy1jhmk.bkt.clouddn.com/bg.png');background-repeat: no-repeat;background-size:100% 100%;}
	#id-center{text-align: center;margin-top: 150px;color:#D71A18}
	.am-btn:active:focus, .am-btn:focus{outline: none !important;}
	.am-form-success .am-radio-inline,.am-form-success label,.am-form-success [class*=icon-],i[class*=icon-]{color:#DD514C !important;}
	h1{font-size: 1.3em;}
	.dcode{font-size: 22px;color:#DD514C;font-weight: bold;}
	@media only screen and (min-width:641px) {
		#id-main{width: 684px;height:965px; background-image: url('http://ocsy1jhmk.bkt.clouddn.com/bg.png');background-repeat: no-repeat;}
		#id-center{margin-top: 220px;}
		h1{font-size: 1.5em;}
	}
	</style>
</head>
<body>
	<div id="id-main" class="am-g">
		<div class="am-u-sm-1 am-u-md-2">&nbsp;</div>
		<div class="am-u-sm-10 am-u-md-8">
			<div id="id-center">
				<h1>泰州互联网联谊会邀请您参加</h1>
				<h1 style="margin: 10px 0 30px 0;">2017年首届新春聚会</h1>
				<form action="#" class="am-form" id="id-form" method="post">
					<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
					<div class="am-form-group">
						<input name="realname" type="text" class="am-round" id="id-input-realname" data-validation-message="请输入2-3个中文" placeholder="输入您的真实姓名" pattern="^([\u4e00-\u9fa5]{2,3})$" required/>
				    </div>
				    <div class="am-form-group">
				    	<input name="phonenumber" type="text" class="am-round" id="id-input-phonenumber" placeholder="输入您的手机号码" data-validation-message="请输入符合规范的手机号码" pattern="^1[358][0-9]{9}$" required/>
				    </div>
				    <div class="am-form-group">
				    	<label class="am-radio-inline am-danger"><input type="radio" name="type" value="1" data-am-ucheck checked>其他</label>
				    	<label class="am-radio-inline am-danger"><input type="radio" name="type" value="2" data-am-ucheck >程序员</label>
				    	<label class="am-radio-inline am-danger"><input type="radio" name="type" value="3" data-am-ucheck >美工</label>
				    	<label class="am-radio-inline am-danger"><input type="radio" name="type" value="4" data-am-ucheck >业务员</label>
				    	<label class="am-radio-inline am-danger"><input type="radio" name="type" value="5" data-am-ucheck >创业者</label>
					</div>
					<div class="am-form-group">
						<button id="id-btn-submit" type="submit" class="am-btn am-btn-danger am-round" style="width: 200px;">注册</button>
					</div>
				</form>
			</div>
		</div>
		<div class="am-u-sm-1 am-u-md-2">&nbsp;</div>
	</div>
	<div class="am-modal am-modal-alert" tabindex="-1" id="id_dg_alert">
	  <div class="am-modal-dialog">
	    <div class="am-modal-hd">泰州互联网联谊会</div>
	    <div class="am-modal-bd" id="id_alert_msg"></div>
	    <div class="am-modal-footer">
	      <span class="am-modal-btn">确定</span>
	    </div>
	  </div>
	</div>
	<script src="${rc.contextPath}/resources/js/jquery.min.js"></script>
	<script src="${rc.contextPath}/resources/amazeui/js/amazeui.min.js"></script>
	<script type="text/javascript">
	/* 自己的alert函数，模式对话框显示简单消息 */
	function fn_alert(msg) {
		$('#id_alert_msg').html(msg);
		$('#id_dg_alert').modal();
	}
	
	$(function() {
	  $('#id-form').validator({
	    onValid: function(validity) {
	      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
	    },
	
	    onInValid: function(validity) {
	      var $field = $(validity.field);
	      var $group = $field.closest('.am-form-group');
	      var $alert = $group.find('.am-alert');
	      // 使用自定义的提示信息 或 插件内置的提示信息
	      var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
	
	      if (!$alert.length) {
	        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
	          appendTo($group);
	      }
	
	      $alert.html(msg).show();
	    },
	    validateOnSubmit: true,
	    submit:function(){
	    	if(this.isFormValid()){
	    		$.ajax({
	    			type:"post",
	    			url  : "#", 
	    			data : $("#id-form").serialize(),
	    			success : function(result){
	    				if(result.resultCode == 0){
	    					fn_alert("登记成功，感谢您的参与。您的登记号为：<i class=\"dcode\">" + result.data.id + "</i>，请妥善保管，为防止重名，之后将通过登记号参与相关活动。如您遗忘了您的登记号，请与<a href='mailto:newflydd@189.cn'>newflydd@189.cn</a>联系。");
	    					$("#id-btn-submit").addClass("am-disabled");
	    				}else{
	    					fn_alert(result.message);
	    				}
	    			},
	    			error : function(){fn_alert("抱歉，没能登记成功，请联系newflydd@189.cn")},
	    			dataType : "json"
	    		});
	    	}
	    	
	    	return false;
	    }
	  });
	});
	</script>
</body>
</html>